class ShopItemModel {

	private _carData: CarData;
	private _Item: Carrun.UI_shopItem;
	public constructor(item, data) {
		this._Item = item;
		this._carData = data;
		this.initItem();
	}
	public get carData() {
		return this._carData
	}
	public get carItem() {
		return this._Item;
	}
	/**初始化item的显示 */
	private initItem() {
		this._Item.m_moneyTxt.text = this.carData.buyMoney.toString();
		this._Item.m_levelTxt.text = "等级：" + (this.carData.level + 1);
		this._Item.m_carLoader.url = this.carData.carImgUrl;
		this._Item.m_buyBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.buyBtnClickHandler, this);
		if (Number(this._Item.m_moneyTxt.text) > MainSceneCotrol.inst().myMoney) {
			this._Item.m_buyBtn.enabled = false;
		} else {

			this._Item.m_buyBtn.enabled = true;
		}
	}
	/**购买按钮点击事件 */
	private buyBtnClickHandler() {
		console.log(this._carData.level.toString());

	}
}